<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title><{$title}></title>
         <link rel="stylesheet" href="./public/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="./public/my.css">
    </head>
    <body>
    
        <div class="container" id="con">          
            <h1><{$title}></h1>

            <div class="center-bock mt20">
                <a href="./index.php?c=User&a=index" class="btn btn-info">首页</a>
                <a class="btn btn-success" id="add">添加</a>
            </div>
            <hr>
            <{block name="main"}>
            <table class="table table-hover mt20">
                <tr>
                    <th>id</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>班级</th>
                    <th>操作</th>
                </tr>
                <{if $list != null}>
                <{foreach $list as $v}>
                <tr>
                    <td><{$v.id}></td>
                    <td><{$v.name}></td>
                    <td>
                        <{if $v.sex == 0}>女
                        <{else}>男
                        <{/if}>
                    </td>
                    <td><{$v.age}></td>
                    <td><{$v.grade}></td>
                    <td class="col-md-2">
                        <a  class="btn btn-primary" href="./index.php?c=User&a=edit&id=<{$v.id}>" )">编辑</a>
                        <a  class="btn btn-danger" onclick="del(<{$v.id}>)">删除</a>
                    </td>
                </tr>
                <{/foreach}>
                <{else}>暂无数据
                <{/if}>
            </table>
            <{/block}>       
        </div>
        <br><br>
        <!--添加表单 -->
        <div id="box">
            <form name="addForm" onsubmit="return addData()">
                姓名:<input type="text" name="name" class="form-control" /><br>
                性别:&nbsp;&nbsp;<input type="radio" name="sex" id="" value="0" checked/>女&nbsp;&nbsp;
                <input type="radio" name="sex" id="" value="1" />男<br><br>
                年龄:<input type="text" name="age" class="form-control"/><br>
                班级:<input type="text" name="grade" class="form-control"/><br>
                <button class="btn btn-success">添加</button>
            </form>         
        </div>
        <br>
        <hr>
        <br>
       <!--修改表单-->
        <div id="box2">
            <{if !empty($data)}>
            <{foreach $data as $v}>
            <form name="editForm" onsubmit="return editData()">
                <input type="hidden" name="id" value="<{$v.id}>" />
                姓名:<input type="text" name="name" value="<{$v.name}>" class="form-control"/><br><br>
                性别&nbsp;&nbsp;:<input type="radio" name="sex" value="0"<{if $v.sex == 0}>checked<{else}><{/if}>/>女&nbsp;&nbsp;
                <input type="radio" name="sex" value="1"<{if $v.sex == 1}>checked<{else}><{/if}>/>男<br><br>
                年龄:<input type="text" name="age" value="<{$v.age}>" class="form-control"/><br><br>
                班级:<input type="text" name="grade" value="<{$v.grade}>" class="form-control"/><br><br>
                <button class="btn btn-primary">修改</button>
            </form> 
            <{/foreach}>
            <{else}>
            <{/if}>
        </div>



        <script src="./public/js/jquery.min.js"></script>
        <script src="./public/js/my.js"></script>
        <script src="./public/js/bootstrap.min.js"></script>

    </body>
</html>